package com.jfinal.weixin.demo.jiemeng;

/**
 * Created by wangxiaoyang on 16/8/28.
 */
public class MengBean {

    public String code = "";
    public String msg = "";

    public MengItem[] newslist;

    public String format() {
        if( null == newslist || newslist.length == 0 ) {
            return "没有查询到结果。";
        }
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("结果如下:\n");
        if ( newslist.length == 1 ) {
            stringBuffer.append( newslist[0].result );
        } else {
            for( int i = 0 ; i < newslist.length ; i++ ) {
                stringBuffer.append(i+1);
                stringBuffer.append(" ");
                stringBuffer.append(newslist[i].result);
                stringBuffer.append("\n");
            }
        }
        return stringBuffer.toString();
    }


    public static class MengItem {
        public String id = "";
        public String type = "";
        public String title = "";
        public String result = "";
    }

}
